<%--
  Created by IntelliJ IDEA.
  User: Master
  Date: 25.11.2010
  Time: 20:16:29
  To change this template use File | Settings | File Templates.
--%>
<%@page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.transcargo.data.CountriesData" %>
<%@ page import="com.transcargo.geo.Country" %>
<%@ page import="com.transcargo.geo.Region" %>
<%@ page import="com.transcargo.geo.City" %>
<%@ page import="java.util.Date" %>
<%@include file="header.jsf"%>
<%@include file="session.jsf"%>
<%@include file="resolve_country.jsf"%>
<%
	Date date = new Date();
	Country[] countries = CountriesData.getCountries(dbase);

%>
<html>
  	<head><title>TransCargo</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <script type="text/javascript" src="ajaxrequest.js"></script>
	<script type="text/javascript" src="chooseareas.js"></script>
    <script type="text/javascript" src="forms.js"></script>
	<link type="text/css" href="transcargo.css" rel="stylesheet"/>

<script type="text/javascript">
var xslDoc = new Array();
var xslDocNames = new Array();
xslDocNames[0] = 'transform/freight.xslt';
xslDocNames[1] = 'transform/cargo.xslt';
xslDocNames[2] = 'transform/empty.xslt';
if (window.DOMParser == null) {
  xslDoc[0]=new ActiveXObject("Microsoft.XMLDOM");
  xslDoc[0].async="false";
  xslDoc[1]=new ActiveXObject("Microsoft.XMLDOM");
  xslDoc[1].async="false";
  xslDoc[2]=new ActiveXObject("Microsoft.XMLDOM");
  xslDoc[2].async="false";
}

var num_countries=<%=countries.length%>;
var Countries=new Array();
var CountryValues=new Array();
<%
    for (int i = 0; i < countries.length; i++) {
        Country country = countries[i];
        out.println("Countries[" + i + "]='" + country.getName() + "';");
        out.println("CountryValues[" + i + "]='" + country.getId() + "';");
    }
%>
var cid = <%=country_id%>;

</script>
  </head>
  <body>
    <table cellpadding="0" cellspacing="0" border="0" width="100%">
        <tr><td colspan="2">
			<%@include file="page_header.jsf"%>
        </td></tr>
        <tr><td width="80%" align="center">
            <table width="100%" cellpadding="0" cellspacing="0">
	            <tr><td align="center"><h1>ТрансКарго</h1></td></tr>
	            <tr><td align="center"><center>Поиск</center>
            <form name="sform" id="sform">
				<table border="0" cellpadding="0" cellspacing="0" width="800">
                <tr class="tdFormSearch"><td><b>Место загрузки:</b></td><td align="left">
						<div id="FromPlaceHolder"></div></td></tr>
                <tr class="tdFormSearch"><td><b>Место выгрузки:</b></td><td align="left">
						<div id="ToPlaceHolder"></div></td></tr>
				    <tr><td class="tdFormSearch">Тип транспорта:</td><td><select name="cargo_type" id="cargo_type" class="selNormal">
			        <option value="0" selected>любой</option>
					<%
					        iter = null;
					        list = dbase.execute("SELECT id, name from transport_type");
					        if (list != null) iter = list.iterator();
                            int i = 0;
                            while (iter.hasNext()) {
                                String[] str = iter.next();
                                %><option value="<%=str[0]%>"><%=str[1]%></option><%
                                i++;
                            }
					%>
				    </select></td></tr>
				    <tr><td class="tdFormSearch">Дата:</td><td><input name="date" id="date" value="<%=date.getDate()%>.<%=date.getMonth()+1%>.<%=date.getYear()+1900%>" size="11" onfocus="gfPop.fPopCalendar(document.getElementById('date'));return false;"></td></tr>
				    <tr valign="middle"><td class="tdFormSearch">Вес:</td><td><input size="4" name="weight_from" value="0">-<input size="4" name="weight_to" value="20"> т.</td></tr>
				    <tr valign="middle"><td class="tdFormSearch">Объем:</td><td><input size="4" name="volume_from" value="0">-<input size="4" name="volume_to" value="82"> м<sup>3</sup></td></tr>
				    <tr><td class="tdFormSearch">Ищу</td><td><input name="what" type="radio" value="1" checked>Транспорт<br><input name="what" type="radio" value="2">Груз<br></td></tr>
				    <tr><td colspan="2"><a href="javascript:toggleAdvanced();">Показать/Скрыть дополнительные параметры</a></td></tr>
				    <tr style="visibility: hidden;position: absolute;" id="AdvProp"><td colspan="2">
						<table border="0" cellpadding="0" cellspacing="0">
					    <tr><td class="tdFormSearch">Тип загрузки:</td><td align="left">
						<%
						        iter = null;
						        list = dbase.execute("SELECT id, name from transport_loading");
						        if (list != null) iter = list.iterator();
					            while (iter.hasNext()) {
					                String[] str = iter.next();
					                %><input type="checkbox" name="load<%=str[0]%>"><%=str[1]%><br><%
					            }
						%>
						</td></tr>
						<tr><td class="tdFormSearch">TIR:</td><td><input type="checkbox" name="tir"></td></tr>
						<tr><td class="tdFormSearch">EKMT:</td><td><input type="checkbox" name="tir"></td></tr>
						<tr><td class="tdFormSearch">Класс ADR:</td><td align="left"><select name="adr">
		                    <option value="">-</option>
		                    <option value="1">1 и выше</option>
		                    <option value="2">2 и выше</option>
		                    <option value="3">3 и выше</option>
		                    <option value="4">4 и выше</option>
		                    <option value="5">5 и выше</option>
		                    <option value="6">6 и выше</option>
		                    <option value="7">7 и выше</option>
		                    <option value="8">8 и выше</option>
		                    <option value="9">9</option>
		                </select></td></tr>
						<tr><td class="tdFormSearch">Срочный:</td><td><input type="checkbox" name="urgent"></td></tr>
						<tr><td class="tdFormSearch">Сборный:</td><td><input type="checkbox" name="combined"></td></tr>
						<tr><td class="tdFormSearch">Попутный:</td><td><input type="checkbox" name="passing"></td></tr>
						<tr><td class="tdFormSearch">Со ставкой:</td><td><input type="checkbox" name="bid"></td></tr>
						</table>
					</td></tr>
				    <tr><td colspan="2"><input type="submit" id="btn1" value="Найти" onclick="submitSearch();return false;"></td></tr>
				</table>
				</td></tr>
        	</table>
			</form>
			<iframe width=174 height=189 name="gToday:cal:none" id="gToday:cal:none" src="calendar/cal.htm" scrolling="no" frameborder="0" style="visibility:visible; z-index:999; position:absolute; top:-500px; left:-500px;"></iframe>
        </td><td valign="top"><%@include file="login.jsf"%><br><%@include file="quicksearch.jsf"%></td></tr>
        <tr><td colspan="3" align="left"><div id="MsgArea"></div></td></tr>
    </table>
<script type="text/javascript">
	var ef = document.getElementById('FromPlaceHolder');
	var et = document.getElementById('ToPlaceHolder');
	AddSearchArea('From',ef, 40);
	AddSearchArea('To',et, 40);
</script>
  </body>
</html>
